_STD -> _VSTD to avoid macro clash on windows git-svn-id: https://llvm.org/svn/llvm-project/libcxx/trunk@134190 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/random b/include/random index 49646e9..ace47a1 100644 --- a/include/random +++ b/include/random
@@ -2313,37 +2313,37 @@ _B, _T, _C, _L, _F>& __y) { if (__x.__i_ == __y.__i_) - return _STD::equal(__x.__x_, __x.__x_ + _N, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + _N, __y.__x_); if (__x.__i_ == 0 || __y.__i_ == 0) { - size_t __j = _STD::min(_N - __x.__i_, _N - __y.__i_); - if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, + size_t __j = _VSTD::min(_N - __x.__i_, _N - __y.__i_); + if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_)) return false; if (__x.__i_ == 0) - return _STD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_); - return _STD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j); + return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _N, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + (_N - __j), __y.__x_ + __j); } if (__x.__i_ < __y.__i_) { size_t __j = _N - __y.__i_; - if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), + if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_)) return false; - if (!_STD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N, + if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _N, __y.__x_)) return false; - return _STD::equal(__x.__x_, __x.__x_ + __x.__i_, + return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_N - (__x.__i_ + __j))); } size_t __j = _N - __x.__i_; - if (!_STD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), + if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_)) return false; - if (!_STD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N, + if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _N, __x.__x_)) return false; - return _STD::equal(__y.__x_, __y.__x_ + __y.__i_, + return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_N - (__y.__i_ + __j))); } @@ -2621,37 +2621,37 @@ if (__x.__c_ != __y.__c_) return false; if (__x.__i_ == __y.__i_) - return _STD::equal(__x.__x_, __x.__x_ + _R, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + _R, __y.__x_); if (__x.__i_ == 0 || __y.__i_ == 0) { - size_t __j = _STD::min(_R - __x.__i_, _R - __y.__i_); - if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, + size_t __j = _VSTD::min(_R - __x.__i_, _R - __y.__i_); + if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + __x.__i_ + __j, __y.__x_ + __y.__i_)) return false; if (__x.__i_ == 0) - return _STD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_); - return _STD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j); + return _VSTD::equal(__x.__x_ + __j, __x.__x_ + _R, __y.__x_); + return _VSTD::equal(__x.__x_, __x.__x_ + (_R - __j), __y.__x_ + __j); } if (__x.__i_ < __y.__i_) { size_t __j = _R - __y.__i_; - if (!_STD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), + if (!_VSTD::equal(__x.__x_ + __x.__i_, __x.__x_ + (__x.__i_ + __j), __y.__x_ + __y.__i_)) return false; - if (!_STD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R, + if (!_VSTD::equal(__x.__x_ + (__x.__i_ + __j), __x.__x_ + _R, __y.__x_)) return false; - return _STD::equal(__x.__x_, __x.__x_ + __x.__i_, + return _VSTD::equal(__x.__x_, __x.__x_ + __x.__i_, __y.__x_ + (_R - (__x.__i_ + __j))); } size_t __j = _R - __x.__i_; - if (!_STD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), + if (!_VSTD::equal(__y.__x_ + __y.__i_, __y.__x_ + (__y.__i_ + __j), __x.__x_ + __x.__i_)) return false; - if (!_STD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R, + if (!_VSTD::equal(__y.__x_ + (__y.__i_ + __j), __y.__x_ + _R, __x.__x_)) return false; - return _STD::equal(__y.__x_, __y.__x_ + __y.__i_, + return _VSTD::equal(__y.__x_, __y.__x_ + __y.__i_, __x.__x_ + (_R - (__y.__i_ + __j))); } @@ -2744,7 +2744,7 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(_Engine&& __e) - : __e_(_STD::move(__e)), __n_(0) {} + : __e_(_VSTD::move(__e)), __n_(0) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit discard_block_engine(result_type __sd) : __e_(__sd), __n_(0) {} @@ -2944,7 +2944,7 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(_Engine&& __e) - : __e_(_STD::move(__e)) {} + : __e_(_VSTD::move(__e)) {} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit independent_bits_engine(result_type __sd) : __e_(__sd) {} @@ -3167,7 +3167,7 @@ #ifndef _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(_Engine&& __e) - : __e_(_STD::move(__e)) {__init();} + : __e_(_VSTD::move(__e)) {__init();} #endif // _LIBCPP_HAS_NO_RVALUE_REFERENCES _LIBCPP_INLINE_VISIBILITY explicit shuffle_order_engine(result_type __sd) : __e_(__sd) {__init();} @@ -3292,7 +3292,7 @@ const shuffle_order_engine<_Eng, _K>& __x, const shuffle_order_engine<_Eng, _K>& __y) { - return __x._Y_ == __y._Y_ && _STD::equal(__x._V_, __x._V_ + _K, __y._V_) && + return __x._Y_ == __y._Y_ && _VSTD::equal(__x._V_, __x._V_ + _K, __y._V_) && __x.__e_ == __y.__e_; } @@ -3418,7 +3418,7 @@ template<class _OutputIterator> _LIBCPP_INLINE_VISIBILITY void param(_OutputIterator __dest) const - {_STD::copy(__v_.begin(), __v_.end(), __dest);} + {_VSTD::copy(__v_.begin(), __v_.end(), __dest);} private: // no copy functions @@ -3443,7 +3443,7 @@ { if (__first != __last) { - _STD::fill(__first, __last, 0x8b8b8b8b); + _VSTD::fill(__first, __last, 0x8b8b8b8b); const size_t __n = static_cast<size_t>(__last - __first); const size_t __s = __v_.size(); const size_t __t = (__n >= 623) ? 11 @@ -3453,7 +3453,7 @@ : (__n - 1) / 2; const size_t __p = (__n - __t) / 2; const size_t __q = __p + __t; - const size_t __m = _STD::max(__s + 1, __n); + const size_t __m = _VSTD::max(__s + 1, __n); // __k = 0; { result_type __r = 1664525 * _T(__first[0] ^ __first[__p] @@ -3639,7 +3639,7 @@ uniform_real_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { return (__p.b() - __p.a()) - * _STD::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g) + * _VSTD::generate_canonical<_RealType, numeric_limits<_RealType>::digits>(__g) + __p.a(); } @@ -3871,9 +3871,9 @@ if (0 < __p_ && __p_ < 1) { __r0_ = static_cast<result_type>((__t_ + 1) * __p_); - __pr_ = _STD::exp(_STD::lgamma(__t_ + 1.) - _STD::lgamma(__r0_ + 1.) - - _STD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _STD::log(__p_) + - (__t_ - __r0_) * _STD::log(1 - __p_)); + __pr_ = _VSTD::exp(_VSTD::lgamma(__t_ + 1.) - _VSTD::lgamma(__r0_ + 1.) - + _VSTD::lgamma(__t_ - __r0_ + 1.) + __r0_ * _VSTD::log(__p_) + + (__t_ - __r0_) * _VSTD::log(1 - __p_)); __odds_ratio_ = __p_ / (1 - __p_); } } @@ -4025,10 +4025,10 @@ _RealType exponential_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { - return -_STD::log + return -_VSTD::log ( result_type(1) - - _STD::generate_canonical<result_type, + _VSTD::generate_canonical<result_type, numeric_limits<result_type>::digits>(__g) ) / __p.lambda(); @@ -4180,7 +4180,7 @@ __v = _Uni(__g); __s = __u * __u + __v * __v; } while (__s > 1 || __s == 0); - result_type _F = _STD::sqrt(-2 * _STD::log(__s) / __s); + result_type _F = _VSTD::sqrt(-2 * _VSTD::log(__s) / __s); _V_ = __v * _F; _V_hot_ = true; _U = __u * _F; @@ -4297,7 +4297,7 @@ template<class _URNG> _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p) - {return _STD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));} + {return _VSTD::exp(const_cast<normal_distribution<result_type>&>(__p.__nd_)(__g));} // property functions _LIBCPP_INLINE_VISIBILITY @@ -4446,7 +4446,7 @@ { __s_ = 0; __d_ = 0; - __l_ = _STD::exp(-__mean_); + __l_ = _VSTD::exp(-__mean_); __omega_ = 0; __c3_ = 0; __c2_ = 0; @@ -4456,7 +4456,7 @@ } else { - __s_ = _STD::sqrt(__mean_); + __s_ = _VSTD::sqrt(__mean_); __d_ = 6 * __mean_ * __mean_; __l_ = static_cast<result_type>(__mean_ - 1.1484); __omega_ = .3989423 / __s_; @@ -4523,20 +4523,20 @@ const result_type __fac[] = {1, 1, 2, 6, 24, 120, 720, 5040, 40320, 362880}; __px = -__pr.__mean_; - __py = _STD::pow(__pr.__mean_, (double)__x) / __fac[__x]; + __py = _VSTD::pow(__pr.__mean_, (double)__x) / __fac[__x]; } else { double __del = .8333333E-1 / __x; __del -= 4.8 * __del * __del * __del; double __v = __difmuk / __x; - if (_STD::abs(__v) > 0.25) - __px = __x * _STD::log(1 + __v) - __difmuk - __del; + if (_VSTD::abs(__v) > 0.25) + __px = __x * _VSTD::log(1 + __v) - __difmuk - __del; else __px = __x * __v * __v * (((((((.1250060 * __v + -.1384794) * __v + .1421878) * __v + -.1661269) * __v + .2000118) * __v + -.2500068) * __v + .3333333) * __v + -.5) - __del; - __py = .3989423 / _STD::sqrt(__x); + __py = .3989423 / _VSTD::sqrt(__x); } double __r = (0.5 - __difmuk) / __pr.__s_; double __r2 = __r * __r; @@ -4545,13 +4545,13 @@ __r2 + __pr.__c1_) * __r2 + __pr.__c0_); if (__using_exp_dist) { - if (__pr.__c_ * _STD::abs(__u) <= __py * _STD::exp(__px + __e) - - __fy * _STD::exp(__fx + __e)) + if (__pr.__c_ * _VSTD::abs(__u) <= __py * _VSTD::exp(__px + __e) - + __fy * _VSTD::exp(__fx + __e)) break; } else { - if (__fy - __u * __fy <= __py * _STD::exp(__px - __fx)) + if (__fy - __u * __fy <= __py * _VSTD::exp(__px - __fx)) break; } } @@ -4642,7 +4642,7 @@ _LIBCPP_INLINE_VISIBILITY result_type operator()(_URNG& __g, const param_type& __p) {return __p.b() * - _STD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());} + _VSTD::pow(exponential_distribution<result_type>()(__g), 1/__p.a());} // property functions _LIBCPP_INLINE_VISIBILITY @@ -4786,7 +4786,7 @@ extreme_value_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { return __p.a() - __p.b() * - _STD::log(-_STD::log(1-uniform_real_distribution<result_type>()(__g))); + _VSTD::log(-_VSTD::log(1-uniform_real_distribution<result_type>()(__g))); } template <class _CharT, class _Traits, class _RT> @@ -4923,7 +4923,7 @@ const result_type __w = __u * (1 - __u); if (__w != 0) { - const result_type __y = _STD::sqrt(__c / __w) * + const result_type __y = _VSTD::sqrt(__c / __w) * (__u - result_type(0.5)); __x = __b + __y; if (__x >= 0) @@ -4931,7 +4931,7 @@ const result_type __z = 64 * __w * __w * __w * __v * __v; if (__z <= 1 - 2 * __y * __y / __x) break; - if (_STD::log(__z) <= 2 * (__b * _STD::log(__x / __b) - __y)) + if (_VSTD::log(__z) <= 2 * (__b * _VSTD::log(__x / __b) - __y)) break; } } @@ -4945,14 +4945,14 @@ const result_type __es = __egen(__g); if (__u <= 1 - __a) { - __x = _STD::pow(__u, 1 / __a); + __x = _VSTD::pow(__u, 1 / __a); if (__x <= __es) break; } else { - const result_type __e = -_STD::log((1-__u)/__a); - __x = _STD::pow(1 - __a + __a * __e, 1 / __a); + const result_type __e = -_VSTD::log((1-__u)/__a); + __x = _VSTD::pow(1 - __a + __a * __e, 1 / __a); if (__x <= __e + __es) break; } @@ -5424,7 +5424,7 @@ { uniform_real_distribution<result_type> __gen; // purposefully let tan arg get as close to pi/2 as it wants, tan will return a finite - return __p.a() + __p.b() * _STD::tan(3.1415926535897932384626433832795 * __gen(__g)); + return __p.a() + __p.b() * _VSTD::tan(3.1415926535897932384626433832795 * __gen(__g)); } template <class _CharT, class _Traits, class _RT> @@ -5662,7 +5662,7 @@ student_t_distribution<_RealType>::operator()(_URNG& __g, const param_type& __p) { gamma_distribution<result_type> __gd(__p.n() * .5, 2); - return __nd_(__g) * _STD::sqrt(__p.n()/__gd(__g)); + return __nd_(__g) * _VSTD::sqrt(__p.n()/__gd(__g)); } template <class _CharT, class _Traits, class _RT> @@ -5843,12 +5843,12 @@ { if (__p_.size() > 1) { - double __s = _STD::accumulate(__p_.begin(), __p_.end(), 0.0); - for (_STD::vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); + double __s = _VSTD::accumulate(__p_.begin(), __p_.end(), 0.0); + for (_VSTD::vector<double>::iterator __i = __p_.begin(), __e = __p_.end(); __i < __e; ++__i) *__i /= __s; vector<double> __t(__p_.size() - 1); - _STD::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin()); + _VSTD::partial_sum(__p_.begin(), __p_.end() - 1, __t.begin()); swap(__p_, __t); } else @@ -5864,8 +5864,8 @@ discrete_distribution<_IntType>::param_type::probabilities() const { size_t __n = __p_.size(); - _STD::vector<double> __p(__n+1); - _STD::adjacent_difference(__p_.begin(), __p_.end(), __p.begin()); + _VSTD::vector<double> __p(__n+1); + _VSTD::adjacent_difference(__p_.begin(), __p_.end(), __p.begin()); if (__n > 0) __p[__n] = 1 - __p_[__n-1]; else @@ -5880,7 +5880,7 @@ { uniform_real_distribution<double> __gen; return static_cast<_IntType>( - _STD::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) - + _VSTD::upper_bound(__p.__p_.begin(), __p.__p_.end(), __gen(__g)) - __p.__p_.begin()); } @@ -6079,14 +6079,14 @@ piecewise_constant_distribution<_RealType>::param_type::__init() { // __densities_ contains non-normalized areas - result_type __total_area = _STD::accumulate(__densities_.begin(), + result_type __total_area = _VSTD::accumulate(__densities_.begin(), __densities_.end(), result_type()); for (size_t __i = 0; __i < __densities_.size(); ++__i) __densities_[__i] /= __total_area; // __densities_ contains normalized areas __areas_.assign(__densities_.size(), result_type()); - _STD::partial_sum(__densities_.begin(), __densities_.end() - 1, + _VSTD::partial_sum(__densities_.begin(), __densities_.end() - 1, __areas_.begin() + 1); // __areas_ contains partial sums of normalized areas: [0, __densities_ - 1] __densities_.back() = 1 - __areas_.back(); // correct round off error @@ -6175,7 +6175,7 @@ { typedef uniform_real_distribution<result_type> _Gen; result_type __u = _Gen()(__g); - ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), + ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1; return (__u - __p.__areas_[__k]) / __p.__densities_[__k] + __p.__b_[__k]; } @@ -6496,7 +6496,7 @@ { typedef uniform_real_distribution<result_type> _Gen; result_type __u = _Gen()(__g); - ptrdiff_t __k = _STD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), + ptrdiff_t __k = _VSTD::upper_bound(__p.__areas_.begin(), __p.__areas_.end(), __u) - __p.__areas_.begin() - 1; __u -= __p.__areas_[__k]; const result_type __dk = __p.__densities_[__k]; @@ -6508,7 +6508,7 @@ const result_type __bk1 = __p.__b_[__k+1]; const result_type __deltab = __bk1 - __bk; return (__bk * __dk1 - __bk1 * __dk + - _STD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) / + _VSTD::sqrt(__deltab * (__deltab * __dk * __dk + 2 * __deltad * __u))) / __deltad; }